package com.itheima.sh;

import com.itheima.sh.config.RedisConfig;
import com.itheima.sh.pojo.User;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.Date;
import java.util.Map;

/**
 * @Description:
 * @Version: V1.0
 */
@SpringBootApplication
//@SpringBootConfiguration  就是 @Configuration， 引导类其实也是配置类
//@ComponentScan  扫描包 默认的扫描规则：当前类所在的包及其子包所有的注解的类
//@EnableAutoConfiguration  核心***
@MapperScan(basePackages = "com.itheima.sh.mapper") // 包
public class DataApplication {


    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(DataApplication.class, args);

        Map<String, RedisConfig> configMap = context.getBeansOfType(RedisConfig.class);
        System.out.println(configMap);


//        User user = new User();
        //user = user.setId(1L).setSex(1);
        User user1 = User
                .builder()

                .id(1L)
                .sex(1)
                .created(new Date())

                .build();
        System.out.println("user1: "+user1);
    }



}
